﻿<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>test Tooltip</title>

	<script type="text/javascript" src="../../../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','SpinWheel','Tooltip']"></script>
	<script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true,  has: {'dojo-bidi': true }"></script>

	<script type="text/javascript">
		require([
			"dijit/registry",		
			"doh/runner",
			"dojo/dom",
			"dojo/ready",
			"dojo/query",			
			"dojox/mobile/Tooltip",
			"dojox/mobile",
			"dojox/mobile/compat",
			"dojox/mobile/parser"			
			], function(registry,runner,dom,ready,query){		
				ready(function(){
					runner.register("Bidi Tooltip", [
						{
							name: "mobile",					
							runTest: function(){
								var tooltip1 = registry.byId('textTooltip1');				        
								tooltip1.set("textDir","rtl");		        
								query(" > *",dom.byId('textTooltip1')).forEach(function(node, index, arr){
									var currentNode = (node.nodeType === 1 && node.childNodes.length === 1) ? node.firstChild : node;
									if(currentNode.nodeType === 1 && currentNode.childNodes.length === 1 && currentNode.nodeValue)					
										runner.is(String.fromCharCode(8235), currentNode.nodeValue.charAt(0), "bidi nodes of first tooltip have direction correspondent to 'textDir'");    
								});
								
								query("> *",dom.byId('textTooltip2')).forEach(function(node, index, arr){
									var currentNode = (node.nodeType === 1 && node.childNodes.length === 1) ? node.firstChild : node;
									if(currentNode.nodeType === 1 && currentNode.childNodes.length === 1 && currentNode.nodeValue)					
										runner.is(String.fromCharCode(8235), currentNode.nodeValue.charAt(0), "bidi nodes of second tooltip have direction correspondent to 'textDir'");    
								});				        			        				        
							}
						}
					]);	 			
					
					runner.register("log", function(){
						dom.byId('failures').innerHTML = runner._failureCount;
						dom.byId('errors').innerHTML = runner._errorCount;
					});

					runner.run();
				});
			},
			toggleTextDir = function(){		
				w2 = dijit.registry.byId("textTooltip1");
				w2.set("textDir", (w2.get("textDir") !== "rtl") ? "rtl" : "ltr");
			});			
	</script>

	<style>
	.dj_phone BUTTON {
		display:none;
	}
	INPUT {
		font-family: monospace;
		border-radius: 0px;
	}
	#spin1 {
		width: 304px;
 	}
	#pt {
		width: 20px;
		background-color: #C4C9DB;
		opacity: 0.2;
	}
	#txt {
		width: 10px;
		margin-left: -15px;
		padding-top: 85px;
		font-size: 24px;
		font-weight: bold;
		border: none;
	}
	HTML {
		min-height: 100%; /* workaround for android 3.x position:fixed bug */
	}
	</style>
</head>
<body style="visibility:hidden;">
	<center style="width:100%;">	
		<input readonly onclick="dijit.byId('textTooltip1').show(this, ['above-centered','below-centered','after','before'])" value="below" size="5">
		<br><br><b>Click boundary nodes to see tooltips</b>
		<br><input id="btn" type="button" onclick="toggleTextDir()" value="Toggle tooltip textDir"><br>		
	</center>
	<center id="bot" class="bottom" style="position:fixed;bottom:10%;width:100%;">
		<input readonly tabindex="0" onclick="dijit.byId('textTooltip1').show(this, ['above-centered','below-centered','before','after'])" value="above" size="5">
	</center>
	<center style="position:fixed;bottom:33%;width:100%;">
		<input readonly onclick="dijit.byId('textTooltip1').hide()" value="click to hide text tooltip" size="26">
	</center>
	<div style="position:fixed;top:50%;left:1px;direction:ltr;">
		<input readonly onclick="dijit.byId('textTooltip1').show(this, ['before','after','below-centered','above-centered'])" value="right" size="5">
	</div>
	<div style="position:fixed;bottom:50%;right:1px;direction:rtl;">
		<input readonly onclick="dijit.byId('textTooltip1').show(this, ['after','before','below','above'])" value="left" size="4">
	</div>

	<div id="textTooltip1" data-dojo-type="dojox/mobile/Tooltip"  class="mblTooltipBubble">Dear friend!<br><span style="background-color:Lime">Enter any value.</span><br><center>Please!</center><div style="border:solid; text-align:center"> Thanks.</div> </div>
	<div id="textTooltip2" data-dojo-type="dojox/mobile/Tooltip" data-dojo-props='textDir:"rtl"' class="mblTooltipBubble">Dear friend!<br><span style="background-color:Lime">Enter any value.</span><br><center>Please!</center><div style="border:solid; text-align:center"> Thanks.</div> </div>

	<div style="position:fixed;bottom:0;">	
	<br>Errors:&nbsp;<span id="errors">?</span>
	<br>Failures:&nbsp;<span id="failures">?</span>	
	</div>
</body>
</html>
